﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ATEC.ATDataCoreNET;
namespace ATSceneExample
{
    public partial class ATSceneExampleForm : Form
    {
        public ATSceneExampleForm()
        {
            InitializeComponent();
        }

        private void btn_ShowScenes_Click(object sender, EventArgs e)
        {
            ATProject activeProject = ATEC.ATCore.Session.Entity.GetActiveATProject();
            SceneIndexCollection modelIndexCollections = activeProject.GetSceneIndexCollection();
            List<SceneManagerInfo> sceneInfoList = new List<SceneManagerInfo>();
            foreach (SceneIndex index in modelIndexCollections)
            {
                SceneManagerInfo sceneInfo = new SceneManagerInfo();
                sceneInfo.SceneName = index.Name;
                sceneInfoList.Add(sceneInfo);
            }

            ATSceneManagerForm modelMng = new ATSceneManagerForm(sceneInfoList);
            modelMng.ShowDialog();
        }

        private void btn_Create3DDesignScence_Click(object sender, EventArgs e)
        {
            ATSceneMethod.Create3DDesignScene();
        }

        private void btn_Delete3DDesignScene_Click(object sender, EventArgs e)
        {
            ATSceneMethod.Delete3DDesignScene();
        }

        private void btn_Rename3DDesignScene_Click(object sender, EventArgs e)
        {
            ATSceneMethod.Rename3DDesignScene();
        }

        private void btn_AttachNestedScenes_Click(object sender, EventArgs e)
        {
            ATAttachmentExample.AttachcNestedScenes();
        }

        private void btn_AttachParallelScenes_Click(object sender, EventArgs e)
        {
            ATAttachmentExample.AttachcParallelScenes();
        }

        private void btn_RotateAttachment_Click(object sender, EventArgs e)
        {
            ATAttachmentExample.RotateAttachment();
        }

        private void btn_ScaleAttachment_Click(object sender, EventArgs e)
        {
            ATAttachmentExample.ScaleAttachment();
        }

        private void btnExportDGN_Click(object sender, EventArgs e)
        {
            ATSceneRef scene = SSDPNET.ScenesFunctions.SceneRefGetActive(); //指定场景
            string dgnFilePath = "";  //dgnFile名称
            string dgnModelName = "";//dgnModel名称
            bool exportToSameNameDgnModel = true;

            //该接口将始终覆盖已有dgn文件
            //导出到dgn中的模型名称是否为场景名称
            //如果为true,将导出到与场景同名的dgn模型中，dgnModelName可以为空
            //如果为false,且dgnModelName不为空，则导入到指定的dgn模型中
            //如果为false,且dgnModelName为空，则导入到默认的dgn模型中
            SSDPNET.ScenesFunctions.SceneRefExportToDGN(scene, dgnFilePath, dgnModelName, exportToSameNameDgnModel);
        }
    }
}
